//
//  TestScrollorBannerVC.m
//  TestAfn2
//
//  Created by XuJingJing on 16/7/14.
//  Copyright © 2016年 xujingjing. All rights reserved.
//

#import "TestScrollorBannerVC.h"
#import "FScrollView.h"
#import "XJScrollNoUrlView.h"
#import "HADirect.h"



#define urlStr @"http://img.smartmiyi.com/banner1464239165199__SJBANER2.JPG"
#define redirectUrlStr @"http://www.sinata.cn:9402/swimQinghai/manage"


@interface TestScrollorBannerVC ()
{

    NSArray *_dataBannerArr;
    NSArray *_dataBannerRedirectArr;

}

@property (strong, nonatomic)  FScrollView *fscrollView;  //点击可以跳转详情
@property (strong, nonatomic)  XJScrollNoUrlView *xjScrollView; //点击不可以跳转详情
@property (strong,nonatomic) HADirect *hadirectView;
@property (weak, nonatomic) IBOutlet UIView *firstView;  //放第一个可跳转的广告轮播图
@property (weak, nonatomic) IBOutlet UIView *secondView;  //放第二个不可跳转的广告轮播图
@property (weak, nonatomic) IBOutlet UIView *third;


@end

@implementation TestScrollorBannerVC

- (void)viewDidLoad {
    [super viewDidLoad];

    _dataBannerArr = [NSArray array];
    _dataBannerArr = @[urlStr,urlStr,urlStr,urlStr];
    _dataBannerRedirectArr = @[redirectUrlStr,redirectUrlStr,redirectUrlStr,redirectUrlStr];
    
    [self FScrollViewBannerRefreshDataArr];//加载可以跳转的bannner, 缺点：跳转数组数量不能小于图片数组数量
    [self refreshXjScrollViewBannerDataArr];//只需要图片，不用跳转
    [self hadirectScrollviewBannner];
}



-(void)FScrollViewBannerRefreshDataArr{

    _fscrollView = [[FScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREENH_HEIGHT*2/7)
                                       withimagearry:_dataBannerArr
                                         redirectUrl:_dataBannerRedirectArr];

    [_firstView addSubview:_fscrollView];
    
    //刷新数据源
    [_fscrollView loadImageWithArr:_dataBannerArr
                        RedicreArr:_dataBannerRedirectArr];
    
}



-(void)refreshXjScrollViewBannerDataArr{
        
        _xjScrollView = [[XJScrollNoUrlView alloc]initWithFrame:CGRectMake(0, 0,CGRectGetWidth(self.view.bounds),SCREENH_HEIGHT*2/7)
                                                  withimagearry:_dataBannerArr];
        
        _xjScrollView.back.hidden = NO;

        [_secondView addSubview:  _xjScrollView];
    
    //刷新数据源
        [_xjScrollView loadImageWithArr:_dataBannerArr];

    
}

- (void)hadirectScrollviewBannner{
 
    _hadirectView = [HADirect direcWithtFrame:self.view.frame ImageArr:_dataBannerArr AndImageClickBlock:^(NSInteger index) {
        
        NSLog(@"%ld",index);
    }];
    [_third addSubview:_hadirectView];


}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
